﻿// pch.cpp: 与预编译标头对应的源文件

#include "pch.h"

// 当使用预编译的头时，需要使用此源文件，编译才能成功。
extern "C" DWORD addrToString(PVOID pAddress)
{
	DWORD dwRet = 0;

	try
	{
		if (NULL == pAddress)
		{
			return dwRet;
		}

#ifdef _DEBUG
		dwRet = ((DWORD)pAddress + 4);
#else
		dwRet = ((DWORD)pAddress);
#endif
	}
	catch (...)
	{
		dwRet = 0;
	}

	return dwRet;
}


extern "C" DWORD stringToAddr(PVOID pAddress)
{
	DWORD dwRet = 0;

	try
	{
		if (NULL == pAddress)
		{
			return dwRet;
		}

#ifdef _DEBUG
		dwRet = ((DWORD)pAddress);
#else
		dwRet = ((DWORD)pAddress + 4);
#endif
	}
	catch (...)
	{
		dwRet = 0;
	}

	return dwRet;
}

extern "C" DWORD stringToAddrEx(PVOID pAddress)
{
	DWORD dwRet = 0;

	try
	{
		if (NULL == pAddress)
		{
			return dwRet;
		}

#ifdef _DEBUG
		dwRet = ((DWORD)pAddress - 4);
#else
		dwRet = ((DWORD)pAddress);
#endif
	}
	catch (...)
	{
		dwRet = 0;
	}

	return dwRet;
}


extern "C" DWORD stringGetLen()
{
	DWORD dwRet = 0;
#ifdef _DEBUG
	dwRet = sizeof(std::string) - 4;
#else
	dwRet = sizeof(std::string);
#endif

	return dwRet;
}